package com.itheima.blog.search.controller;

import com.itheima.blog.search.domain.dto.SearchDTO;
import com.itheima.blog.search.service.ITBlogService;
import com.itheima.common.domain.DTO.LogStateDTO;
import com.itheima.common.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;


@RestController
@RequestMapping()
@RequiredArgsConstructor
public class BlogController {

    private final ITBlogService blogService;

    @PostMapping("/key")
    public R search(@RequestBody SearchDTO search) throws IOException {
        return blogService.search(search);
    }


    //该接口实现设置Es上的文章是否展示，LogStateDTO类中status字段为true展示，否则不展示
    @GetMapping("/updateStatus")
    public boolean updateStatus(@RequestBody LogStateDTO logStateDTO){
       return blogService.updateStatus(logStateDTO);
    }

}
